package com.richpencil.sqlsearch;


import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import lombok.Data;

import java.util.List;
import java.util.Map;


@Data
public class SQLStatement {

    public String fid="";
    public String fsqlstatement="";
    public String proceduretypeid="";
    public String projectid="";
    public String fissearch="";
    public String fmodule="";
    public String ffixsql="";
    public String ffinalsql="";
    private List<SQLStatementItem> items= Lists.newArrayList();
    public List<String> array= Lists.newArrayList();
    private Map<String, SQLStatementItem> m= Maps.newHashMap();


    public void addItem(SQLStatementItem item){

        if(!m.containsKey(item.paramname))
        {
            item.setSqlStatement(this);
            m.put(item.paramname, item);
        }
    }

    public SQLStatementItem getSQLItem(String key)
    {
        String k=key.toLowerCase();
        if(!m.containsKey(k)) {
            return null;
        } else {
            return m.get(k);
        }
    }

}
